package com.fzshang.api.controller;


import com.alipay.api.AlipayApiException;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fzshang.commen.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;

/**
 * <p>
 * 支付回调
 * </p>
 *
 * @author 张子艺
 * @since 2019-04-17
 */
@Controller
@RequestMapping("/success/callback")
public class CallBackController {
    @Autowired
    UserService userService;

    /**
     * @param request
     * @return 添加订单支付宝支付异步回调
     * @throws Exception
     */
    @RequestMapping(value = "/machineSuccess" )
    @ResponseBody
    public String  machineSuccess(HttpServletRequest request) throws Exception {
        return  userService.aliPayNotify(request);
    }


    @RequestMapping(value = "/successReturn.html")
    public String successReturnHtml(HttpServletRequest request) {
      return "paySuccess";
    }

}
